<?php


class Framework_DB_Table_FileMeta extends Framework_DB_Table_Common {

	public $tableName = 'FileMeta';
	
	public function __construct($db) {
   		
   		// Columns
   		$this->col = array(
	   		// Primary Key
	        'idFileMeta'  => array(
	           'type'     => 'integer',
	           'require'  => true
	        ),
	      
	        'extension'   => array(
	           'type'     => 'varchar',
			   'size'     => 5
	        ),
	        
	        'mime'   => array(
	           'type'     => 'varchar',
			   'size'     => 50
			),
	        
	        'fileType'   => array(
	           'type'     => 'varchar',
			   'size'     => 50
			)
	        	
	        
	    );
	    
	    
	    $this->auto_inc_col = 'idFileMeta';
	    
	    // Indexes
	    $this->idx = array(
	    	'idFileMeta'  =>  'primary'
	    );
   		
	    parent::__construct($db);
   }
   
   // Populate upon creation
   public function create($flag)
   {
   		
   		$result = parent::create($flag);
   	
   		if($result == true){
   			$data = array(
   				array('jpg', 'image/pjpeg', 'image'),
   				array('jpg', 'image/jpeg', 'image'),
   				array('png', 'image/png', 'image'),
   				array('png', 'image/x-png', 'image'),
   				array('gif', 'image/gif', 'image'),
   				array('txt', 'text/plain', 'text'),
   				array('css', 'text/css', 'text')
   			);
   			
   			foreach($data AS $insertItem) {
   				$this->insert(array('extension' => $insertItem[0],
   									'mime' => $insertItem[1],
   									'fileType' => $insertItem[2]));
   				
   			}
   			
   		}
   		
   		return $result;
   	
   }
	
	
}

?>